home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / libgimp / gimpbrushes_pdb.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-26  |  2.7 KB  |  87 lines

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimpbrushes_pdb.c
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with this library; if not, write to the
  18.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.  * Boston, MA 02111-1307, USA.
  20.  */
  21.  
  22. /* NOTE: This file is autogenerated by pdbgen.pl */
  23.  
  24. #include <string.h>
  25.  
  26. #include "gimp.h"
  27.  
  28. /**
  29.  * gimp_brushes_get_brush_data:
  30.  * @name: the brush name (\"\" means current active pattern).
  31.  * @opacity: The brush opacity.
  32.  * @spacing: The brush spacing.
  33.  * @paint_mode: The paint mode.
  34.  * @width: The brush width.
  35.  * @height: The brush height.
  36.  * @length: Length of brush mask data.
  37.  * @mask_data: The brush mask data.
  38.  *
  39.  * Retrieve information about the currently active brush (including
  40.  * data).
  41.  *
  42.  * This procedure retrieves information about the currently active
  43.  * brush. This includes the brush name, and the brush extents (width
  44.  * and height). It also returns the brush data.
  45.  *
  46.  * Returns: The brush name.
  47.  */
  48. gchar *
  49. gimp_brushes_get_brush_data (gchar                 *name,
  50.                  gdouble               *opacity,
  51.                  gint                  *spacing,
  52.                  GimpLayerModeEffects  *paint_mode,
  53.                  gint                  *width,
  54.                  gint                  *height,
  55.                  gint                  *length,
  56.                  guint8               **mask_data)
  57. {
  58.   GimpParam *return_vals;
  59.   gint nreturn_vals;
  60.   gchar *ret_name = NULL;
  61.  
  62.   return_vals = gimp_run_procedure ("gimp_brushes_get_brush_data",
  63.                     &nreturn_vals,
  64.                     GIMP_PDB_STRING, name,
  65.                     GIMP_PDB_END);
  66.  
  67.   *length = 0;
  68.  
  69.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  70.     {
  71.       ret_name = g_strdup (return_vals[1].data.d_string);
  72.       *opacity = return_vals[2].data.d_float;
  73.       *spacing = return_vals[3].data.d_int32;
  74.       *paint_mode = return_vals[4].data.d_int32;
  75.       *width = return_vals[5].data.d_int32;
  76.       *height = return_vals[6].data.d_int32;
  77.       *length = return_vals[7].data.d_int32;
  78.       *mask_data = g_new (guint8, *length);
  79.       memcpy (*mask_data, return_vals[8].data.d_int8array,
  80.           *length * sizeof (guint8));
  81.     }
  82.  
  83.   gimp_destroy_params (return_vals, nreturn_vals);
  84.  
  85.   return ret_name;
  86. }
  87.